﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WeatheRx.Data;
using WeatheRx.Managers.Search;

namespace WeatheRx.Web.Controllers
{
    public class HomeController : Controller
    {
        [Authorize]
        public ActionResult Index()
        {
            return View();
        }

        /*
        public ActionResult Search(SearchModel searchModel)
        {
            var model = new SearchResultsModel() { SearchTerm = searchModel.SearchTerm };
            ViewBag.Title = "Search for" + model.SearchTerm;

            using (var db = new HWAPEntities())
            {
                var jobs = db.Jobs.Where(x =>
                    (x.StreetNumber + " " + x.Orient + " " + x.StreetName).Contains(model.SearchTerm) ||
                    (x.OwnerFirstName + " " + x.OwnerLastName).Contains(model.SearchTerm) ||
                    (x.Applicants.Any(y =>
                        (y.FirstName + " " + y.LastName + " " + y.StreetNumber + " " + y.StreetOrientation + " " +
                         y.StreetName).Contains(model.SearchTerm))
                        )).ToList();
                model.Jobs = Mapper.Map<List<JobHeaderModel>>(jobs);
            }
            return View(model);
        }
        */

        public ActionResult Login()
        {
            return View();
        }
    }
}